<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/WEB-INF/webpage/common/taglibs.jspf"%>
<!DOCTYPE html>
<html>
<head>
    <title>项目经纬度坐标</title>
    <meta name="decorator" content="form"/>
    <html:css name="bootstrap-fileinput" />
    <html:css name="simditor,jquery-select2" />
    <html:js name="jquery-select2"/>    
</head>

<body class="white-bg"  formid="eqProjectCoordinatesForm">
    <form:form id="eqProjectCoordinatesForm" modelAttribute="data" action="${adminPath}/xmgl/eqprojectcoordinates/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<form:hidden path="pId"/>
		<form:hidden path="projectName"/>
		<table  class="table table-bordered  table-condensed dataTables-example dataTable no-footer">
		   <tbody>
		   		<tr>
					<td  class="width-15 active text-right">	
		              <label>项目名称:</label>
		            </td>
					<td class="width-35" colspan=3>
						<form:input path="projectName" htmlEscape="false" class="form-control"  readonly="true"    />
						<label class="Validform_checktip"></label>
					</td>
				</tr>
<%-- 				<tr>
					<td  class="width-15 active text-right">	
		              <label>项目:</label>
		            </td>
					<td class="width-35" colspan=3>
						<form:input path="projectId" htmlEscape="false" class="form-control"      />
						<form:select path="projectId" />
						<label class="Validform_checktip"></label>
					</td>
				</tr> --%>
				<tr>
					<td  class="width-15 active text-right">	
		              <label><font color="red">*</font>经度:</label>
		            </td>
					<td class="width-35">
						<form:input path="longitude" htmlEscape="false" class="form-control"      />
						<label class="Validform_checktip"></label>
					</td>
					<td  class="width-15 active text-right">	
		              <label><font color="red">*</font>纬度:</label>
		            </td>
					<td class="width-35">
						<form:input path="lantitude" htmlEscape="false" class="form-control"      />
						<label class="Validform_checktip"></label>
					</td>
				</tr>
				<tr>
					<td  class="width-15 active text-right">	
		              <label>排序号:</label>
		            </td>
					<td class="width-35">
						<form:input path="sort" htmlEscape="false" class="form-control"      />
						<label class="Validform_checktip"></label>
					</td>
					<td  class="width-15 active text-right">	
		              <label><font color="red">*</font>类型:</label>
		            </td>
					<td class="width-35">
						<form:input path="type" htmlEscape="false" class="form-control"   dataType="*"   />
						<label class="Validform_checktip"></label>
					</td>
		  		</tr>
				<tr>
					<td  class="width-15 active text-right">	
		              <label>备注信息:</label>
		            </td>
					<td class="width-35">
						<form:input path="remarks" htmlEscape="false" class="form-control"      />
						<label class="Validform_checktip"></label>
					</td>
					<td  class="width-15 active text-right">	
		              <label></label>
		            </td>
					<td class="width-35">
					</td>
		  		</tr>
		      
		   </tbody>
		</table>   
	</form:form>


<script type="text/javascript">

$(function() {
	var sec = $("select[name=projectId]");
	if($("#pId").val()){
		var data = [{ id: $("#pId").val(), text: $("#projectName").val()}];
		//加载默认项
		sec.select2({
		 data: data,
		 placeholder:'请选择或输入',
		 allowClear:true
		});		
	}
	sec.select2({
		language: "zh-CN",
		width: '100%',
		dropdownAutoWidth : true,
		placeholder:'请选择或输入',
			ajax : {
				url : "${adminPath}/sbfb/eqprojectinfo/ajaxList",
				dataType : 'json',
				delay : 300,
				data :function(req,page){
 					return {
 						'page.size':1000,
						'queryFields':'id,name,',
						'query.name||like' : req.term
					};
				}, 
				processResults:function(data){
					if(data.results){
						var my_result=[];
						data.results.forEach(function(item){
							my_result.push({
								'id':item.id,
								'text':item.name
							})
						})
						return {results:my_result}
					}else{
						console.error("服务端返回异常!!!",data);
					}
					
				},
				cache : true
			},
			minimumInputLength : 2
		}); 
	
		//sec.select2().val($("#pId").val()).trigger("change");
	})
	
</script>

</body>
</html>